home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_100
/
199_01
/
ged.h
< prev
next >
Wrap
Text File
|
1987-12-15
|
18KB
|
579 lines
/*
Header: CUG199;
Title: Header include file of ged editor DeSmet, MSC and TurboC;
Last Updated: 11/29/87;
Description: "PURPOSE: standard header file, included in all function files,
NB. e/qed/ged does NOT require <stdio.h>)";
Keywords: e, editor, qed, ged, DeSmet, MSDOS;
Filename: ged.h;
Warnings: must be included in all ged files
Authors: G. Nigel Gilbert, James W. Haefner, and Mel Tearle;
Compilers: DeSmet 3.0;
References:
Endref
*/
/*
e/qed/ged screen editor
(C) G. Nigel Gilbert, MICROLOGY, 1981 - August-December 1981
licensed for private non-profitmaking use 1983
Modified: Aug-Dec 1984: BDS-C 'e'(vers 4.6a) to 'qe' (J.W. Haefner)
March 1985: BDS-C 'qe' to DeSmet-C 'qed' (J.W. Haefner)
May 1986: qed converted to ged (Mel Tearle)
August 1987: ged converted to MSC 4.0 (Mel Tearle)
File: ged.h
*/
#include <dos.h>
#ifdef MSC
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <io.h>
#include <direct.h>
#include <fcntl.h>
#include <process.h>
#include <malloc.h>
#include <string.h>
#include <sys\types.h>
#include <sys\stat.h>
#include <setjmp.h>
#endif /* MSC */
#ifdef TC
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <io.h>
#include <fcntl.h>
#include <process.h>
#include <mem.h>
#include <string.h>
#include <sys\stat.h>
#define _memavl coreleft
#endif /* TC */
/* fixes for DeSmet - MSC/TC
*/
#ifndef DS
#define index strchr
#define _os(a,b) bdos(a,b,0)
#define creat(file) creat(file,S_IREAD|S_IWRITE)
#endif
#define STKSPACE 1024 /* space for the stack */
#define SECSIZ 128 /* file buffer definitions */
#define NSECTS 16
#define IOBUFSIZ ( NSECTS * SECSIZ + 6 )
#define FILELEN 64 /* max length of file name */
#define JBUFSIZE 6 /* size of buffer required for longjumps */
#define BUFFER 16 /* generic buffer size */
#define REFORM 72 /* default line size used in reformatting paragraph */
#define FLIM 80 /* max length of find/alter string */
#define LLIM 255 /* max length of a line */
#define FAIL -1
#define DFAIL 0xff /* DeSmet read fail flag for returning char */
#define NULL 0
#define YES 1
#define NO 0
#define FALSE 0
#define TRUE 1
#define PREV -2
#define HELP 1 /* table assignments */
#define TABLE1 2
#define TABLE2 3
#define WINDOW 9 /* last line of display */
#define PAGEOVERLAP 1 /* overlap between pages with UP,DOWN-PAGE */
#define OFFWIDTH 32 /* horizontal scroll increment */
#define SHEIGHT 23 /* screen height */
#define PATHLEN 32 /* display lenght of path */
#define SWIDTH 79 /* screen width */
#define NLINES 6 /* number of lines to skip at bottom of page */
#define PAGELEN 66 /* length of page, used in listfile() */
#define EMPOS 0 /* position of error message */
#define WAITPOS 0 /* position of cursor when searching/reading */
#define LNPOS 0 /* position of line number */
#define COLPOS 10 /* position of column number */
#define REPPOS 19 /* position of "Replace?" cursor */
#define CAPLK 19 /* position of capslock message */
#define FNPOS 27 /* status line - position of file name */
#define OVERT 64 /* position of overstrike message */
#define TIMEPOS 75 /* position of current time */
#define BACKSP 0x08 /* backspace */
#define ENDFILE 0x1a /* CP/M end of text file mark */
#define CTRL 0x1f /* last control char */
#define PARBIT 0x80 /* parity bit used as a flag by testkey() */
#define NKEYS 32 /* number of key codes */
#define HISTLEN 100 /* history stack of commands for undoing */
#define HISTINSERT 1 /* type of command on history stack */
#define HISTDELETE 2
#define HISTREPLACE 3
/* Internal key codes - recommended key assignments in brackets
*/
#define LEADIN 0 /* lead in chararacter to key codes -
ignored, but following key code parity set */
#define DOWNKEY 1 /* cursor down */
#define UPKEY 2 /* cursor up */
#define LEFTKEY 3 /* cursor left */
#define RIGHTKEY 4 /* cursor right */
#define RIGHTWKEY 5 /* cursor right one word (D) */
#define LEFTWKEY 6 /* cursor left one word (S) */
#define EOLKEY 7 /* cursor to end of line (E) */
#define BOLKEY 8 /* cursor to beginning of line (B) */
#define UPPAGE 9 /* scroll up a page (W) */
#define DOWNPAGE 10 /* scroll down a page (Z) */
#define BOFKEY 11 /* cursor to beginning of file (U) */
#define HOMEKEY 12 /* cursor to end of file (HOME) */
#define DELLEFT 13 /* delete char to left of cursor (DEL) */
#define DELRIGHT 14 /* delete char under cursor (G) */
#define DELLNKEY 15 /* delete cursor line (Y) */
#define DELWDKEY 16 /* delete word to right of cursor (T) */
#define JUMPKEY 17 /* jump to (X) */
#define CRSTILL 18 /* insert newline after cursor (N) */
#define QWIKKEY 19 /* quit (Q) */
#define SCRLDNKEY 20 /* edit and file context (C) */
#define TOPSCRKEY 21 /* find (F) */
#define BOTSCRKEY 22 /* alter (A) */
#define BLOCKKEY 23 /* block operations (O) */
#define SCRLUPKEY 24 /* read a file (P) */
#define REPKEY 25 /* repeat last find/alter (R) */
#define HELPKEY 26 /* display help menu (V) */
#define OOPSKEY 27 /* restore unedited line (\) */
#define TAB 28 /* tab (I) */
#define RETRIEVE 29 /* retrieve last name etc entered here (R) */
#define CR 30 /* return (M) */
#define ESCKEY 31 /* the magic escape key (ESC) */
/* key codes + 0x80 (PARBIT) - used in scanning strings of ctrl chars
*/
#define LEFTKEY_P 131
#define DELLEFT_P 141
#define RETRIEVE_P 157
#define CR_P 158
#define ESCKEY_P 159
#define F1KEY 128 /* these chars are now off limits */
#define F2KEY 129 /* but I doubt if it will matter much */
#define F3KEY 130
#define F4KEY 145
#define F5KEY 132
#define F6KEY 133
#define F7KEY 134
#define F8KEY 135
#define F9KEY 136
#define F10KEY 137
#define INSKEY 138
#define CAPSLKON 139
#define CAPSLKOFF 140
#define ALTKEY 146
#define GREYMINUS 142
#define GREYPLUS 143
/* screen attributes */
#define BRIDIM '|' /* char placed in message strings to start/stop
dim ( half-intensity ) display */
#define DIM 4
#define HIGH 13
#define RSFW 104
#define REVS 112
#define dim() attr = DIM
#define high() attr = HIGH
/* dos interrupts */
#define DOSINT 0x21
#define SELDSK 0x0E
#define CURDSK 0x19
#define LSTOUT 0x05
#define SETDIR 0x3b
#define GETDIR 0x47
/* file management */
#define MAXSLOTS 255 /* virtual memory constants */
#define MAXMEMSLOTS 64 /* 36 for 64k TPA (CP/M816); old = 20 */
#define PAGESIZE 1024
#define PAGESECTS ( PAGESIZE/SECSIZ )
#define FREE 0
#define INUSE 1
#define NOTAVAIL -1
#define MAXINT 32767
#define NOFILE (MAXINT)
#define ABSOLUTE 0
#define UNKNOWN (MAXINT)
#define VERNO 0x30 /* get MSDOS version number */
#define debug scr_delete(0,24); /* 24th line */
/* the structure of the file buffers
*/
struct iobuffer {
int _fd;
int _nleft;
char *_nextp;
char _buff[ NSECTS * SECSIZ ];
};
/* address of text of each line
*/
struct addr {
int page;
int moffset;
} *tp;
/* command history stack for undo()
*/
struct hi